{include file="common/head_s"/}
<body>  
<div class="rl_main">
<div class="reg_box box_pan layui-clear">  
    <div class="log_logo"><img src="{$sys.logo}" alt="{$sys.name}"></div>
    <form method="post" class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label for="L_username" class="layui-form-label">姓　　名</label>
            <div class="layui-input-block">
                <input type="text" id="L_username" name="username" lay-verify="required" placeholder="请输入您的真实姓名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_mobile" class="layui-form-label">码商手续费</label>
            <div class="layui-input-block">
                <input type="text" id="L_userlv" name="userlv" lay-verify="required|number" placeholder="码商手续费" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_mobile" class="layui-form-label">手  机  号</label>
            <div class="layui-input-block">
                <input type="text" id="L_mobile" name="mobile" lay-verify="required|phone" placeholder="请输正确的手机号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_email" class="layui-form-label">邮箱账号</label>
            <div class="layui-input-block">
                <input type="text" id="L_email" name="email" lay-verify="required|email" placeholder="请输正确的邮箱" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_pass" class="layui-form-label">登录密码</label>
            <div class="layui-input-block">
                <input type="password" id="L_pass" name="password" lay-verify="required"  placeholder="请输入6到16个字符" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">确认密码</label>
            <div class="layui-input-block">
                <input type="password" id="L_repass" name="password2" lay-verify="required" placeholder="确认密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        {if $sys.code=='open'}
        <div class="layui-form-item">
            <label for="L_vercode" class="layui-form-label">验  证  码</label>
            <div class="layui-input-block">
                <input type="text" id="L_vercode" name="vercode" lay-verify="required"  placeholder="验证码" autocomplete="off" class="layui-input">
            </div>
            <div class="rtip"><img src="{:url('verify')}" alt="图形验证码" onclick="this.src='{:url("verify")}?'+'id='+Math.random()"/></div>
        </div>
        {/if} 
        <button type="submit" class="layui-btn layui-btn-fluid layui-btn-warm" lay-filter="regsub" lay-submit>确认开通</button>        
    </form> 
</div>
</div>
{include file="common/footer"/}
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,$ = layui.jquery;
        // 登录提交监听
        form.on('submit(regsub)', function (data) {
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            data.field.agentid="{$agentid}"; 
            $.post("{:url('reg')}",data.field,function(res){
                layer.close(loading);
                if(res.code > 0){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        if(data.field.agentid){ 
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 
                            parent.layer.close(index); //再执行关闭，强制关闭弹窗  
                        }else{
                            location.href = "{:url('index/index')}";
                        } 
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                    $('.rtip img').attr('src','{:url("verify")}?id='+Math.random());
                }
            });
            return false;
        }); 
    });
</script>
</body>
</html>